package com.iversonx.facade.example_1.remote.impl;

import com.iversonx.facade.example_1.remote.CostingService;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.stereotype.Service;

/**
 *
 **/
@Service
public class CostingServiceImpl implements CostingService {
    private final Logger logger = LoggerFactory.getLogger(CostingServiceImpl.class);
    @Override
    public float applyDiscount(float price, float discountPercent) {
        String out = String.format(
                "A discount of %f%% has been applied on the product's price of %f",
                discountPercent, price);
        logger.info(out);
        return price - ((discountPercent / 100) * price);
    }
}
